#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 110, mod = 1e6 + 7;
int f[N];
int a[N];
int n, m;
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    f[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = m; j >= 0; j--)
        {
            for (int k = 1; k <= a[i] && k <= j; k++)
            {
                f[j] = (f[j] + f[j - k]) % mod;
            }
        }
    }
    cout << f[m] << endl;
    return 0;
}